package com.resou.reader.mine.login;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.resou.reader.R;
import com.resou.reader.base.v.BaseActivity;
import com.resou.reader.mine.userinfo.UserInfoActivity;

import butterknife.BindView;
import butterknife.ButterKnife;

public class ChoicePhotoActivity extends BaseActivity {
    private static final String TAG = "ChoicePhotoActivity";

    @BindView(R.id.imageView)
    ImageView mImageVew;
    @BindView(R.id.tv_submit)
    TextView tvSubmit;

    @Override
    protected void initView() {
//        Bitmap bm = (Bitmap) getIntent().getExtras().get("data");
//        mImageVew.setImageBitmap(bm);
        String url = getIntent().getStringExtra("url");
        if (!TextUtils.isEmpty(url)) {
            Glide.with(this).load(url).into(mImageVew);
        }
        tvSubmit.setOnClickListener((v)->{
            UserInfoActivity.start(this, url);
        });
    }

    @Override
    protected void retryRefreshData() {

    }

    @Override
    protected void initPresenter() {

    }

    @Override
    public int getLayoutId() {
        return R.layout.activity_choice_photo;
    }

    public static void startActivity(Context context, String url) {
        Intent intent = new Intent(context, ChoicePhotoActivity.class);
        intent.putExtra("url", url);
        context.startActivity(intent);
    }

    @Override
    public Context getViewContext() {
        return this;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ButterKnife.bind(this);
    }

}
